import java.util.*;

public class Player
{
    private int strength = 100;
    private int ATK = 15;
    private int DEF = 10;
    private int ThingATK = 0;
    private int ThingDEF = 0;
    private int strengthExpend=7;
    private static Map<String, Thing> bag = new HashMap<>();
    
    public void step() {
        strength -= strengthExpend;
    }
  
    public void pick(Thing thing) {
        bag.put(thing.getName(), thing);
        System.out.println("捡到了："+"["+thing.getName()+","+thing.getEnergy()+"]");
    }
    
    public void eat(String name) {
        Thing thing = bag.get(name);
        if(thing != null) {
            int strengthago=strength;
            strength += thing.getEnergy();
            bag.keySet().removeIf(key -> key.contains(name));
            if(strength >100) {
                strength = 100;
            }
            System.out.println("吃掉："+name+" "+"回复："+(strength-strengthago)+"血量");
        }
    }
    
    public void equip(String name)
    {
        Thing thing = bag.get(name);
        if(thing != null) {
            if(thing.getKind()=="攻击装")
            {
                ThingATK=thing.getValue();
                System.out.println("装备"+name+" "+"当前武器攻击力: "+ThingATK);
            }
            if(thing.getKind()=="防御装")
            {
                ThingDEF=thing.getValue();
                System.out.println("装备"+name+" "+"当前武器防御力: "+ThingDEF);
            }
        }
    }
    
    public void show()
    {
        System.out.println("当前武器攻击力: "+ThingATK);
        System.out.println("当前武器防御力: "+ThingDEF);
        System.out.println("当前攻击力: "+ATK);
        System.out.println("当前防御力: "+DEF);
        System.out.println("当前血量: "+strength);
        System.out.println("当前行动消耗: "+strengthExpend);
    }
    
    public void checkBag() {
        System.out.println("背包里有:");
        bag.keySet().stream().forEach(key -> System.out.print(key + " "+"能量值："+bag.get(key).getEnergy()));
        System.out.println(); 
    }
    
    public boolean isDead(String str) {
        if(strength <= 0)
        {
        System.out.println("魔王没有生命值了?不会吧不会吧？不会有人连这么简单的爬塔游戏都会输吧？");
        System.out.println("你可真是一个失败的魔王");
        }
        else
        {
            System.out.println("最后魔王手撕了最后的勇者，这种感觉很爽吧！");
            System.out.println("感谢你的游玩！");
            System.out.println("游戏结束!");
        }
        return strength <= 0;
    }
    public boolean isDead() {
        if(strength <= 0)
        {
        System.out.println("魔王没有生命值了?不会吧不会吧？不会有人连这么简单的爬塔游戏都会输吧？");
        System.out.println("你可真是一个失败的魔王");
        System.out.println("你可真是一个失败的魔王");
        System.out.println("你可真是一个失败的魔王");
        System.out.println("游戏结束!");
        return true;
        }
        return strength <= 0;
    }
    public int getStrengh(){
        return this.strength;
    }
    
    public int getATK(){
        return this.ATK+this.ThingATK;
    }
    
    public void changeStrength(int changesStrength){
        this.strength+=changesStrength;
    }
    
    public void changeATK(int changeedATK){
        this.ATK+=changeedATK;
    }
    
    public int getDEF(){
        return this.DEF+this.ThingDEF;
    }
    
    public void changeDEF(int changeedDEF){
        this.DEF+=changeedDEF;
    }
    
    public int getstrenghExpend(){
        return this.strengthExpend;
    }
    
    public void changestrenghExpend(int changeedStrenghExpend){
        strengthExpend+=changeedStrenghExpend;
    }
}
